package com.ruoyi.framework.config;

import com.crm.sms.biz.SMSClient;
import com.crm.sms.biz.impl.AliyunSMSClient;
import com.crm.sms.biz.impl.MockSMSClient;
import com.crm.sms.biz.impl.QCloudSMSClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class SMSConfig {
    @Value("${sms.enable}")
    private String enable;

    @Bean
    public SMSClient smsClient() {
        if ("qcloud".equals(enable)) {
            return new QCloudSMSClient();
        } else if ("aliyun".equals(enable)) {
            return new AliyunSMSClient();
        } else if ("mock".equals(enable)) {
            return new MockSMSClient();
        } else {
            return new MockSMSClient();
        }
    }
}
